{% extends "main.html" %}
{% block content %}

{% if created %}
  Subscription created.
<br /><br />
{% endif %}

{% if deleted %}
  Subscription removed.
<br /><br />
{% endif %}

<table class="contentTable">
	<tr>
		<td class="left">

			<h3>Add Subscription</h3>

			  <form action="#" method="post">
				<div class="field">
				    <label>Subscriber Address</label> 
				    <input type="textfield" name="receiver_address" />
				</div>

				<div class="field">
				    <label>Type</label>
				    <select name="receiver_type">
				      <option selected="selected">xmpp</option>
				      <option>email</option>
				    </select>
				</div>
    
				<div class="field">
					<label>Domain</label> 
					<input type="textfield" name="domain" />
				</div>

				<div class="field">
				    <label>Context</label> 
					<input type="textfield" name="context" />
				</div>

				<div class="field">
				    <label>Eventtype</label> 
					<input type="textfield" name="eventtype" />
				</div>

				<div class="field">
				    <label>Key</label> 
					<input type="textfield" name="msg_key" />
				</div>

			    <input class="submit" type="submit" />
			  </form>

			</td>

			<td>

				<h3>Subscriptions</h3>

				<table class="listing">
				  <thead>
				    <th>Subscriber</th>
				    <th>Type</th>
				    <th>Domain</th>
				    <th>Context</th>
				    <th>Eventtype</th>
				    <th>Key</th>
				  </thead>
				  {% for s in subscriptions %}
				  <tr>
				    <td class="first">{{s.receiver_address}}</td>
				    <td>{{s.receiver_type}}</td>
				    <td>{{s.domain}}</td>
				    <td>{{s.context}}</td>
				    <td>{{s.eventtype}}</td>
				    <td>{{s.msg_key}}</td>
				    <td class="del"><a href="/subscriptions?delete={{s.key}}">delete</a></td>
				  </tr>
				 {% endfor %}
				</table>
			</td>
		</tr>
	</table>
{% endblock %}